<?php
/**
 * Created by PhpStorm.
 * User: joe
 * Date: 2019-12-12
 * Time: 14:15
 */

namespace app\common\bean\builder;

use app\common\bean\ListMap;
use app\common\bean\TableBean;

/**
 * 增删改查代码生成
 * Class CurdBuilder
 * @package app\common\bean\builder
 */
class CurdBuilder
{
    static $_self = null;

    public static function getInstance()
    {
        if (empty(self::$_self)) {
            self::$_self = new CurdBuilder();
        }
        return self::$_self;
    }

    protected $beanManger = null;

    private function __construct()
    {
        $this->beanManger = new BeanManager();
    }


    /**
     * 获取Bean的增删改查的模板
     * @param TableBean $tableBean
     * @return ListMap
     */
    public function getBeanCurdTpl(TableBean $tableBean)
    {
        $listMap = new ListMap();
        $columns = $this->beanManger->getAllColumn($tableBean);
        $listMap->setParameter("createCode",'123');
        $listMap->setParameter("editCode",'123');
        $listMap->setParameter("listCode",'123');
        return $listMap;
    }
}